package com.lcf.order.VO;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Test1 {

    public static void main(String[] args) {
        test2();

    }

    public static void test1() {
        List<Integer> list = new ArrayList<>();
//        List<int> list2 = new ArrayList<>();
        Integer i = 1;
        Integer j = 1;

        Integer i2 = 0;
        Integer j2 = 0;

        Integer a = 128;
        Integer b = 128;

        Integer c = 127;
        Integer d = 127;

        System.out.println("i==j 为" + (i == j));
        System.out.println("i2==j2 为" + (i2 == j2));
        System.out.println("a==b为" + (a == b));
        System.out.println("c==d 为" + (c == d));

        String aa = "hehe";
        String bb = "he" + "he";
        String cc = new String("hehe");
        String dd = new String("hehe");
        System.out.println("aa==bb 为" + (aa == bb));
        System.out.println("aa==cc 为" + (aa == cc));
        System.out.println("bb==cc 为" + (bb == cc));
        System.out.println("dd==cc 为" + (dd == cc));
    }

    public static void test2() {
        List<UserA> list = new ArrayList<>();
        UserA userA = new UserA("1", "aaa");
        UserA userB = new UserA("2", "bbb");

        list.add(userA);
//        list.add(userB);
        String collect = list.stream().map(a -> a.id).collect(Collectors.joining(","));
        System.out.println(collect);
    }
}

class UserA {
    String id;
    String name;

    public UserA() {
    }

    public UserA(String id, String name) {
        this.id = id;
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}